package com.snow.useviewdemo.function2.statusbar;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;

import com.snow.img.ImageUtil;
import com.snow.useviewdemo.R;
import com.snow.useviewdemo.base.BaseActivity;
import com.snow.useviewdemo.databinding.ActivityStatusStyleBinding;
import com.snow.useviewdemo.util.statusbar.StatusBarCompat;
import com.snow.useviewdemo.util.statusbar.StatusBarUtils;

/**
 * Created by zhaoyingtao
 * Date: 2020/7/8
 * Describe:
 */
public class StatusBarStyleActivity extends BaseActivity<ActivityStatusStyleBinding> {

    private int clickNum = 0;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_status_style;
    }

    View bgTitleBarView;

    @Override
    protected void setViewData(Bundle savedInstanceState) {


        ImageUtil.imageLoad(this, "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2289438758,607665393&fm=26&gp=0.jpg", mBinding.imageView);
        mBinding.imageView.setOnClickListener(view -> {
            clickNum++;
            switchTitleStatus();
        });

        bgTitleBarView = LayoutInflater.from(this).inflate(R.layout.custom_title_bar_view, null, false);
    }

    private void switchTitleStatus() {
        int sss = clickNum % 5;
        Log.e("snow", "======" + sss);
        switch (sss) {
            case 0:
                StatusBarUtils.translucentStatusBar(this, false, true);
                break;
            case 1:
                StatusBarUtils.setStatusBarColor(this, getResources().getColor(R.color.tt_red), 10);
                break;
            case 2:
                StatusBarUtils.setStatusBarGradientColor(this, R.drawable.bg_gradient_study);
//                StatusBarCompat.setStatusBarGradientColor(this, R.drawable.bg_gradient_study);
                break;
            case 3:
                StatusBarUtils.translucentStatusBar(this, true, false);
                break;
            case 4:
//                StatusBarCompat.setPaddingSmart(this,bgTitleBarView);
                break;
        }

    }
}
